﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Zocono.Infrastructure.Common;
using Zocono.WCS.Application.AppTelegramRecordManage;
using Zocono.WCS.Domain.EntityInfo;
using Zocono.WCS.Infrastructure.ApllicationDto.DtoWcsManage;
using Zocono.WCS.Infrastructure.ApllicationDto.WCSTaskDto;

namespace Zocono.WCS.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class TelegramRecordController : ControllerBase
    {
        private readonly ILogUtil _logger;
        private readonly TelegramRecordApp _telegramRecordApp;
        public TelegramRecordController(ILogUtil logger, TelegramRecordApp telegramRecordApp)
        {
            _logger = logger;
            _telegramRecordApp = telegramRecordApp;
        }

        [HttpPost]
        public async Task<HeaderResult<List<TelegramRecordInfoDto>>> GetPagedTelegramRecordInfoAsync(QueryTelegramRecordInfo queryParams)
        {
            try
            {
                var pageList = await _telegramRecordApp.GetPagedTelegramRecordInfoAsync(queryParams);
                return ApiBase.Info(pageList.Result, pageList.Total, "查询成功");
            }
            catch (Exception ex)
            {
                _logger.Error(ex.ToString());
                return ApiBase.Error<List<TelegramRecordInfoDto>>(ex.Message);
            }

        }
    }
}
